package com.example.listener;
import com.example.listener.event.MyEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MyEventListener implements ApplicationListener<MyEvent> {

    @Override
    public void onApplicationEvent(MyEvent myEvent) {
        Object data=myEvent.getSource();
        Object msgName=myEvent.getData();
        log.info(data+" "+msgName+"事件我监听到了");
    }


}
